Sum of square of digits using while loop in Python